package com.neusoft.bizcore.notice.system.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import com.neusoft.bizcore.notice.system.model.enums.SystemNoticeStatus;
import com.neusoft.bizcore.web.jpa.model.AbstractAuditModel;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@ToString
@Entity
@Table(name = "neuiot_system_notice")
public class SystemNotice extends AbstractAuditModel {
    private static final long serialVersionUID = -2375678914873828135L;

    @NotBlank(message = "应用编码不能为空")
    @Length(max = 32, message = "应用编码不能超过{max}位")
    @Column(length = 32, nullable = true)
    private String appCode;

    @Column(length = 255, nullable = true)
    private String noticeType;

    @Column(length = 255, nullable = true)
    private String noticeRoute;

    @Enumerated(EnumType.STRING)
    @NotNull(message = "通知状态不能为空")
    @Column(length = 32, nullable = false)
    private SystemNoticeStatus isRead = SystemNoticeStatus.unRead;

    @Column(length = 255, nullable = false)
    String user;

    @Length(max = 255, message = "标题不能超过{max}位")
    @Column(length = 255, nullable = true)
    private String title;

    @NotBlank(message = "内容不能为空")
    @Lob
    @Column(columnDefinition = "text")
    private String content;

    @Length(max = 1023, message = "业务信息不能超过{max}位")
    @Column(length = 1023, nullable = true)
    private String businessInfo;

}
